package com.riteny.paymentgateway.swifypass.sdk;

import com.riteny.paymentgateway.swifypass.config.SwiftPassPaymentGatewaySetting;
import com.riteny.paymentgateway.swifypass.datasource.MultipleMchProfileDatasource;
import com.riteny.paymentgateway.swifypass.entity.SwiftPassQueryPaymentOrderResponseEntity;
import com.riteny.paymentgateway.swifypass.entity.SwiftPassSubmitPaymentOrderResponseEntity;

/**
 * @author Riteny
 * 2022/1/6  16:24
 */
public class SwiftPassMultiplePaymentGatewaySdkService extends AbstractSwiftPassPaymentGatewaySdkService {

    private MultipleMchProfileDatasource multipleMchProfileDatasource;

    public SwiftPassMultiplePaymentGatewaySdkService(MultipleMchProfileDatasource multipleMchProfileDatasource) {

        super();

        this.multipleMchProfileDatasource = multipleMchProfileDatasource;
    }

    public SwiftPassSubmitPaymentOrderResponseEntity submitUnityOrder(Integer paymentGatewayType, String mchType
            , String orderUuid, String deviceId, Integer totalFee, String body, String nonceStr) {

        SwiftPassPaymentGatewaySetting setting = multipleMchProfileDatasource.getPaymentGatewayProfile(mchType);

        return super.submitUnityOrder(paymentGatewayType, setting, orderUuid, deviceId, totalFee, body, nonceStr);
    }

    public SwiftPassQueryPaymentOrderResponseEntity queryUnityOrder(Integer paymentGatewayType, String mchType, String orderNo) {

        SwiftPassPaymentGatewaySetting setting = multipleMchProfileDatasource.getPaymentGatewayProfile(mchType);

        return super.queryUnityOrder(paymentGatewayType, setting, orderNo);
    }
}
